package net.linlan;

import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import net.linlan.config.DynamicDataSourceConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;


@Import({DynamicDataSourceConfig.class})
@EnableAutoConfiguration(exclude = {
        DataSourceAutoConfiguration.class
})
@Configuration
@MapperScan(basePackages={"net.linlan.**.dao"})
@ComponentScan(basePackages = {"net.linlan"})
@EnableScheduling
@EnableAsync
@ServletComponentScan
@EnableEncryptableProperties//@EnableSwagger2	// 配置swagger 文档
public class MagicApiApplication extends SpringBootServletInitializer
{
    public static void main(String[] args)
    {
        System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(MagicApiApplication.class, args);
        System.out.println("------- 接口管理平台启动成功 -------");
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(MagicApiApplication.class);
    }

}

